#ifndef KERNEL_HAL_x86_GDT_H
#define KERNEL_HAL_x86_GDT_H

#define GDT_TRACE(x ...) HAL_TRACE_DETAILED("GDT: " x)

namespace x86
{
	enum GDT_Flags
	{
		GDT_ACCESSED = 0x0001,
		GDT_WRITABLE = 0x0002,
		GDT_EXPANSION = 0x0004,
		GDT_EXECUTABLE = 0x0008,
		GDT_DESCRIPTOR = 0x0010,
		GDT_RING_0 = 0x0000,
		GDT_RING_1 = 0x0020,
		GDT_RING_2 = 0x0040,
		GDT_RING_3 = 0x0060,
		GDT_PRESENT = 0x0080,
		GDT_16BIT = 0x0000,
		GDT_32BIT = 0x0400,
		GDT_GRANULARITY_BYTE = 0x0000,
		GDT_GRANULARITY_4KB = 0x0800
	};

	class GDT
	{
	public:
		static Result Initialize( void );

	private:
		static void InitializeEntry( int index, uint32 base, uint32 limit, uint16 flags );
	};
}


#endif // KERNEL_HAL_x86_GDT_H
